package com.siki.config.swaggerConfig;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.*;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @Author Siki
 * @Date 2020/3/19
 *
 * @apiNote Swagger的配置类
 */

@Configuration
@EnableSwagger2
public class SwaggerConfig {
    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.siki"))
                .paths(PathSelectors.any())
                .build();
    }


    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("基于Swagger构建的莞青系统 API文档")
                .description("更多请咨询服务开发者siki-七仔 Wechat:Xh934913797 或者来七仔的个人主页逛逛⬇️⬇️")
                .contact(new Contact("七仔", "https://7mage.xyz", "934913797@qq.com"))
//                .termsOfServiceUrl("https://7mage.xyz")
                .version("1.0")
                .build();
    }
}